//
//  HBReadCoverView.m
//  HeartBeat
//
//  Created by karong on 2023/9/12.
//

#import "HBReadCoverView.h"
#import "NSString+Number.h"
#import "HBReadSettingManager.h"

@interface HBReadCoverView ()
@property (weak, nonatomic) IBOutlet UIImageView *coverImage;
@property (weak, nonatomic) IBOutlet UILabel *bookName;
@property (weak, nonatomic) IBOutlet UILabel *authorName;
@end

@implementation HBReadCoverView

- (void)createContentDataWithDataModel:(HBNovelModel *)dataModel {
    self.model = dataModel;
    [self.coverImage sd_setImageWithURL:[NSURL URLWithString:KEmptyStr(dataModel.thumb)]];
    self.bookName.text = dataModel.name;
    self.authorName.text = SF(@"%@·%@·%@", dataModel.author, dataModel.finish_txt, dataModel.word_txt);
    [self loadData];
}

- (void)loadData{
    self.backgroundColor = [[HBReadSettingManager shared] showSkinColor];
    self.bookName.textColor = [UIColor colorFromHexRGB:[[HBReadSettingManager shared] showModel].colorStr];
    self.authorName.textColor = [UIColor colorFromHexRGB:[[HBReadSettingManager shared] showModel].colorStr];
}

- (IBAction)btnAction:(id)sender {
    [UIView animateWithDuration:0.2 animations:^{
        self.alpha = 0;
    } completion:^(BOOL finished) {
        [self removeFromSuperview];
    }];
}
@end
